
import { Component, OnInit } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd/message';
import { GroupService } from 'sparrow-permission-lib';
import { NzTreeCommonService } from 'src/app/service/nz-tree-common.service';


@Component({
  selector: 'app-group-search',
  templateUrl: './group-search.component.html',
  styleUrls: ['./group-search.component.css'],
})
export class GroupSearchComponent implements OnInit {
  modelName?: string;
  constructor(
    private groupService: GroupService,
    private message: NzMessageService,
  ) {}



  ngOnInit(): void {
  }
  dataSource: any;
   // for permission
   optionList: any[] = [];
   selectedUser?: any[];
   isLoading = false;

   onSearch(value: string): void {
     this.isLoading = true;
     this.groupService
       .all5({ page: 0, size: 100 }, value === '' ? undefined : { name: value })
       .subscribe((res) => {
         this.optionList = res.content!;
         this.isLoading = false;
       });
   }
}
